<include file="Public/ace_header" />
<style type="text/css">
.find-input-div {
    margin-bottom: 10px;
}
</style>
<div class="row">
    <div class="col-xs-12">
        <div class="row hidden-480 find">
            <!-- 查询块 -->
            <form id="find-form">
                <div class="col-md-3 find-input-div">
                    <input type="text" class="col-md-12 find-input" name="identity" id="identity" value="{$_GET[identity]}" placeholder="学生身份证号" />
                </div>
                <div class="col-md-3 find-input-div">
                    <input type="text" class="col-md-12 find-input" name="water" id="water" value="{$_GET[water]}" placeholder="流水号" />
                </div>
                <!-- <div class="col-md-3 find-input-div">
                    <select name="way" id="way" class="width-100 find-select">
                        <option value="" class="find-select-default-option">缴费方式</option>
                        <option value="现金" <if condition="$_GET['way'] eq '现金'"> selected </if>>现金</option>
                        <option value="刷卡" <if condition="$_GET['way'] eq '刷卡'"> selected </if>>刷卡</option>
                    </select>
                </div> -->
                <div class="col-md-3 find-input-div">
                    <input type="text" class="col-md-12 find-input" name="update_timeStart" id="update_timeStart" value="{$_GET[update_timeStart]}" placeholder="开始时间" onClick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'})" readonly="" onChange="update_timeStartChange()" />
                </div>
                <div class="col-md-3 find-input-div">
                    <input type="text" class="col-md-12 find-input" name="update_timeEnd" id="update_timeEnd" value="{$_GET[update_timeEnd]}" placeholder="结束时间" onClick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'})" readonly="" onChange="update_timeEndChange()" />
                    <!--   <button type="submit" class="btn btn-success btn-xs" style="width:100px;height:40px;float:right;margin-right:2rem;margin-top:1rem;">查询</button> -->
                </div>
                <div class="col-md-3 find-input-div">
                    <select name="way" id="way" class="width-100 find-select">
                        <option value="" class="find-select-default-option">缴费方式</option>
                        <option value="现金" <if condition="$_GET['way'] eq '现金'"> selected </if>>现金</option>
                        <option value="刷卡" <if condition="$_GET['way'] eq '刷卡'"> selected </if>>刷卡</option>
                        <option value="信用卡" <if condition="$_GET['way'] eq '信用卡'"> selected </if>>信用卡</option>
                        <option value="抵扣" <if condition="$_GET['way'] eq '抵扣'"> selected </if>>抵扣</option>
                        <option value="其他" <if condition="$_GET['way'] eq '其他'"> selected </if>>其他</option>
                        <option value="其他1" <if condition="$_GET['way'] eq '其他1'"> selected </if>>其他1</option>
                        <option value="其他2" <if condition="$_GET['way'] eq '其他2'"> selected </if>>其他2</option>
                        <option value="其他3" <if condition="$_GET['way'] eq '其他3'"> selected </if>>其他3</option>
                    </select>
                </div>
                <div class="col-md-3 find-input-div">
                    <input id="term_name" name="term_name"  value="{$_GET['term_name']}" type="text" class="col-md-12 find-input" placeholder="学期及交费项"/>
                </div>
                <script>
                function update_timeStartChange() {
                    var update_timeEnd = $("#update_timeEnd").val();
                    if (update_timeEnd != "") {
                        var update_timeStart = $("#update_timeStart").val();
                        if (update_timeEnd < update_timeStart) {
                            alert("起始时间必须早于结束时间!");
                            $("#update_timeStart").val("");
                        }
                    }

                }

                function update_timeEndChange() {
                    var update_timeStart = $("#update_timeStart").val();
                    if (update_timeStart != "") {
                        var update_timeEnd = $("#update_timeEnd").val();
                        if (update_timeStart > update_timeEnd) {
                            alert("结束时间必须晚于起始时间!");
                            $("#update_timeEnd").val("");
                        }
                    }
                }
                </script>
                <div class="col-md-3 col-md-offset-3 center find-input-div">
                    <button type="submit" class="btn btn-success btn-xs">查询</button>
                    <button class="btn btn-warning btn-xs" type="button" href="#" onclick="clearFind()">清空</button>
                    <a class="btn btn-pink btn-xs" id="export-btn" href="__CONTROLLER__/RecordO" onclick="return exportExcel()">导出</a>
                    <a class="btn btn-purple btn-xs" href="__CONTROLLER__/RecordI">导入</a>
                    <button class="btn btn-danger btn-xs" type="button" href="javascript:void(0);" id="delall">删除</button>
                </div>
            </form>
        </div>
        <div class="table-responsive">
            <table id="sample-table-1" class="table table-striped table-bordered table-hover">
                <thead>
                    <tr>
                        <th class="center">
                            <label>
                                <input type="checkbox" class="ace" id="checkall" />
                                <span class="lbl"></span>
                            </label>
                        </th>
                        <th class="center">学生姓名</th>
                        <th class="center">学生身份证号</th>
                        <if condition="$_GET['term_name']">
                        <th class="center">应缴总金额</th>
                        <th class="center">实缴总学费</th>
                        <foreach name="fee" item="f">
                        <php>
                         $tuition=D('tuition')->where(['id'=>$f['tuition_id']])->find();
                         $term=D('term')->where(['id'=>$tuition['term_id']])->find();
                        </php>
                        <th class="center">应缴{$term['name']}</th>
                        <th class="center">仍欠{$term['name']}</th>
                        </foreach>
                        <else/>
                        <th class="center">学期及交费项</th>
                        <th class="center">应缴金额</th>
                        <th class="center">实缴学费</th>
                        </if>
                        <th class="center">缴费经办人</th>
                        <th class="center">缴费时间</th>
                        <th class="center">流水号</th>
                        <th class="center">缴费方式</th>
                    </tr>
                </thead>
                <tbody>
                    <volist name="list" id="vo">
                        <tr>
                            <td class="center">
                                <label>
                                    <input type="checkbox" class="ace" name="chkid" value="{$vo['id']}" />
                                    <span class="lbl"></span>
                                </label>
                            </td>
                            <td class="center">
                                <?=M('Student')->find($vo["student_id"])['name'];?>
                            </td>
                            <td class="center">
                                <?=M('Student')->find($vo["student_id"])['identity'];?>
                            </td>
                            <if condition="$_GET['term_name']">
                            <td class="center">{$vo["should"]}</td>
                            <php>
                            $model=D('Tuition')->where(['id'=>$vo['tuition_id']])->find();
                            </php>
                            <td class="center">{$model["money"]}</td>
                            <foreach name="fee" item="f">
                             <th class="center">{$vo[$f['id']]['yingjiao']}</th>
                             <th class="center">{$vo[$f['id']]['rengqian']}</th>
                             </foreach>
                            <else/>
                            <td class="center">
                               <?=M('Term')->find($vo["term_id"])['name'];?>
                            </td>
                            <php>
                              $model=D('Tuition')->where(['id'=>$vo['tuition_id']])->find();
                            </php>
                            <td class="center">{$model["money"]}</td>
                            <td class="center">{$vo["over"]}</td>
                            </if>
                            <td class="center">{$vo['name']}</td>
                            <td class="center">{$vo['update_time']|date="Y-m-d",###}</td>
                            <td class="center">{$vo["water"]}</td>
                            <td class="center">{$vo["way"]}</td>
                        </tr>
                    </volist>
                </tbody>
            </table>
            {$page}
        </div>
        <!-- /.table-responsive -->
    </div>
    <!-- /span -->
</div>
<!-- /row -->
<include file="Public/ace_footer" />